Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

There was a problem

You must be a member of this account.

Text Folding

#5

I have an event with this description String:

"Weather report looks nice, 80 degrees and partly cloudy, so following Michael's suggestion, let's meet at the food court at Crossroads:\n\nhttp://www.shopcrossroadsplaza.com/directory.html\n"

It comes out in the export as this:

DESCRIPTION:Weather report looks nice\, 80 degrees and partly cloudy\, so
  following Michael's suggestion\, let's meet at the food court at Crossr
 oads:
\n
\nhttp://www.shopcrossroadsplaza.com/directory.html
\n

or, if you prefer a String:

"DESCRIPTION:Weather report looks nice, 80 degrees and partly cloudy, so\n  following Michael's suggestion, let's meet at the food court at Crossr\n oads:\n\\n\n\\nhttp://www.shopcrossroadsplaza.com/directory.html\n\\n\n"

Reported by Adam Williams · May 20th, 2009 @ 12:27 PM

State: new
Milestone: none
Assigned to: Rick DeNatale Rick DeNatale

Activity

  1. Adam Williams
    Adam Williams

    In case it's not obvious, the problem, I believe, is that the \n's at the beginning of those lines should have a space in front of them.

    May 20th, 2009 @ 12:40 PM

  2. Rick DeNatale
    Rick DeNatale
    • Assigned user set to Rick DeNatale

    Adam,

    I'm having trouble reproducing this. I added the following to the event_spec

    context ".export" do

    # .. unrelated snippage
    
    before(:each) do
      cal = RiCal.Calendar
      @it = RiCal::Component::Event.new(cal)
    end
    
    # More unrelated snippage ...
    
    it "should properly fold on export" do
      @it.description = "Weather report looks nice, 80 degrees and partly cloudy, so following Michael's suggestion, let's meet at the food court at Crossroads:\n\nhttp://www.shopcrossroadsplaza.c...\n"
      export_string = @it.export
      rputs ("***********")
      rputs export_string
      rputs ("***********")
      export_string.should match(%r(^DESCRIPTION:Weather report looks nice\\, 80 degrees and partly cloudy\\, so$))
      export_string.should match(%r(^  following Michael's suggestion\\, let's meet at the food court at Crossr$))
      export_string.should match(%r(^ oads:\\n\\nhttp://www.shopcrossroadsplaza\.c\.\.\.\\n))
    end
    

    end

    This passes, and the rputs dump this:


    BEGIN:VCALENDAR
    PRODID;X-RICAL-TZSOURCE=TZINFO:-//com.denhaven2/NONSGML ri_cal gem//EN
    CALSCALE:GREGORIAN
    VERSION:2.0
    BEGIN:VEVENT
    DESCRIPTION:Weather report looks nice\, 80 degrees and partly cloudy\, so
    following Michael's suggestion\, let's meet at the food court at Crossr oads:\n\nhttp://www.shopcrossroadsplaza.c...\n END:VEVENT
    END:VCALENDAR


    Can you provide more info on this?

    May 21st, 2009 @ 03:29 PM

  3. Adam Williams
    Adam Williams

    That 'rputs dump' is hard to read on the website showing the ticket, but if it's like the email shows, the problem is that even in that dump, the Ruby String contains "at Crossr\noads:\n\nhttp". Notice that after Crossr, there is an unescaped carriage return, followed immediately by the oads characters. Isn't there supposed to be a space at the beginning of every folded line?

    May 21st, 2009 @ 03:47 PM

  4. Rick DeNatale
    Rick DeNatale

    Here's the actual example:

        it "should properly fold on export" do
          @it.description = "Weather report looks nice, 80 degrees and partly cloudy, so following Michael's suggestion, let's meet at the food court at Crossroads:\n\nhttp://www.shopcrossroadsplaza.c...\n"
          export_string = @it.export
          export_string.should match(%r(^DESCRIPTION:Weather report looks nice\\, 80 degrees and partly cloudy\\, so$))
          export_string.should match(%r(^  following Michael's suggestion\\, let's meet at the food court at Crossr$))
          export_string.should match(%r(^ oads:\\n\\nhttp://www.shopcrossroadsplaza\.c\.\.\.\\n$))
        end
    

    If that doesn't format, then it's in event_spec.rb in the latest push to github, except for the $ in the last regexp, which I just notice was missing and added, but it still passes.

    Notice that I'm checking for an extra space after each line break. And I've attached a file which I wrote from the export which shows things look OK.

    So there must be something else going on with your specific use case.

    May 21st, 2009 @ 07:17 PM

  5. Adam Williams
    Adam Williams

    I think I found the problem.

    it "should sanitize new lines" do
      @it.description = "Come and join us as we hear Andy Stanley take us deeper into how the accuser works in our lives..And how twisted our world is..\r\nYou will not want to miss these next two sessions."
      export_string = @it.export
      export_string.should match(%r(^DESCRIPTION:Come and join us as we hear Andy Stanley take us deeper into $))
      export_string.should match(%r(^ how the accuser works in our lives..And how twisted our world is..\\nYou$))
      export_string.should match(%r(^ will not want to miss these next two sessions.$))
    end
    

    The editor that is producing the content appears to be place "\r\n" in there. So, is it my responsibility to normalize new lines? If you run that, you will see that it is escaping the "\n" part of that "\r\n", but leaving the "\r".

    I have attached an image of how Outlook is choking on the output.

    DESCRIPTION:Come and join us as we hear Andy Stanley take us deeper into 
     how the accuser works in our lives..And how twisted our world is..
    \nYou
      will not want to miss these next two sessions.
    

    May 22nd, 2009 @ 11:06 AM

  6. Rick DeNatale
    Rick DeNatale

    I'm not sure.

    The spec says that an intentional line break should be escaped by \n or \N, but I'm unclear what is meant here by an intentional line break.

    I guess I could convert any of
    \n \r\n \r \n\r

    into "\n" but I'm not sure that that's the right answer. I've asked calsify list for a recommendation, but they haven't been very responsive.

    May 22nd, 2009 @ 11:47 AM

  7. Rick DeNatale
    Rick DeNatale
    • State changed from new to open

    I got one reply from the icalsify list, which indicated that I should treat any combination of /n /r as an "intentional" linebreak

    May 23rd, 2009 @ 04:39 PM

  8. Rick DeNatale
    Rick DeNatale
    • State changed from open to resolved

    May 23rd, 2009 @ 06:28 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.